from django.db import models
import time
# Create your models here.

class Expenditure(models.Model):
    Ename = models.CharField(max_length=16)
    expenditure = models.IntegerField(default=0)
    Etime = models.DateField()

class Room(models.Model):
    Rprice = models.IntegerField(null=False)
    Rtype = models.CharField(max_length=16,null=False)
    Rstatus = models.IntegerField(default=0,null=False)
    Rnum = models.CharField(null=False,max_length=16)

class Service(models.Model):
    Sname = models.CharField(max_length=16,null=False)
    Sprice = models.IntegerField(default=0,null=False)
    Sdescribe = models.TextField(max_length=100,null=True)

class User(models.Model):
    Uname = models.CharField(max_length=16,null=False)
    Utel = models.CharField(max_length=16,null=False)
    Upassward = models.CharField(max_length=20,null=False,default="")


class RoomOrder(models.Model):
    Rid = models.ForeignKey(Room,on_delete=models.CASCADE)
    Uid = models.ForeignKey(User,on_delete=models.CASCADE)
    Identify = models.CharField(max_length=16,null=True)
    ROstatus = models.IntegerField(default=0,null=False)
    ROtime = models.DateField(blank=True, default='', null=True)

class ServiceOrder(models.Model):
    Uid = models.ForeignKey(User,on_delete=models.CASCADE)
    Sid = models.ForeignKey(Service,on_delete=models.CASCADE)
    ROid = models.ForeignKey(RoomOrder,on_delete=models.CASCADE)
    SOstatus = models.IntegerField(default=0,null=False)
    SOtime = models.DateField(blank=True, default='', null=True)
